#include "libGeoutils/tool/datetime_tool.h"
#include "libGeoutils/tool/color_mapper.h"
#include <vector>
#include <iostream>

int main()
{
	std::string op_str;
	geo::tool::ColorRGBA color(255, 0, 0, 255);
	color.toJsonFile("E:/color.txt");
	color.toTextFile("E:/color_2.txt");

	geo::tool::ColorMapper color_mapper("test_mapper", 1);
	color_mapper.appendColorStop(0.2, std::make_shared<geo::tool::ColorRGBA>(10, 0, 0, 255));
	color_mapper.appendColorStop(0.25, std::make_shared<geo::tool::ColorRGBA>(0, 10, 0, 255));
	color_mapper.appendColorStop(0.45, std::make_shared<geo::tool::ColorRGBA>(0, 0, 10, 255));
	color_mapper.appendColorStop(0.5, std::make_shared<geo::tool::ColorRGBA>(127, 0, 0, 255));
	color_mapper.appendColorStop(0.56, std::make_shared<geo::tool::ColorRGBA>(127, 0, 127, 255));
	color_mapper.appendColorStop(0.15, std::make_shared<geo::tool::ColorRGBA>(127, 127, 0, 255));
	color_mapper.appendColorStop(0.75, std::make_shared<geo::tool::ColorRGBA>(0, 127, 127, 255));

	color_mapper.toJsonFile("E:/color_mapper.txt");

	auto color_sptr = color_mapper.mapGray2Color(0.3);
	color_sptr = color_mapper.mapGray2Color(0.1);
	color_sptr = color_mapper.mapGray2Color(-100);
	color_sptr = color_mapper.mapGray2Color(100);
	color_sptr = color_mapper.mapGray2Color(0.00011);
	color_sptr = color_mapper.mapGray2Color(-10000);
	color_sptr = color_mapper.mapGray2Color(1000);
	color_sptr = color_mapper.mapGray2Color(0.35);

	geo::tool::ColorMapper color_mapper_copy("copy_mapper", 1);
	std::string color_mapper_json;
	if (color_mapper.to_json(color_mapper_json)) {
		color_mapper_copy.fromJsonFile("E:/color_mapper.txt");
		color_mapper_copy.setName("copy_mapper");
		color_mapper_copy.setNumber(2333);
		color_mapper_copy.toTextFile("E:/copy_mapper.txt");
	}

	return 0;
}